package com.wedimob.boxinternetprotection.freebox;

import java.util.Observable;

public class FreeboxClientStatus extends Observable {
    private FreeboxClient client;
    private int inactiveTime;
    private boolean isAssociated;
    private int signal;
    private int sentDataSize;
    private int recieveDataSize;

    public FreeboxClientStatus(FreeboxClient client) {
        super();
        this.client = client;
    }

    public int getInactiveTime() {
        return inactiveTime;
    }

    public void setInactiveTime(int inactiveTime) {
        if (inactiveTime != this.inactiveTime)
            notifyObservers(this);
        this.inactiveTime = inactiveTime;
    }

    public boolean isAssociated() {
        return isAssociated;
    }

    public void setAssociated(boolean isAssociated) {
        if (isAssociated != this.isAssociated)
            notifyObservers(this);

        this.isAssociated = isAssociated;
    }

    public int getSignal() {
        return signal;
    }

    public void setSignal(int signal) {
        if (signal != this.signal)
            notifyObservers(this);
        this.signal = signal;
    }

    public int getSentDataSize() {
        return sentDataSize;
    }

    public void setSentDataSize(int sentDataSize) {
        if (sentDataSize != this.sentDataSize)
            notifyObservers(this);
        this.sentDataSize = sentDataSize;
    }

    public int getRecieveDataSize() {
        return recieveDataSize;
    }

    public void setRecieveDataSize(int recieveDataSize) {
        if (recieveDataSize != this.recieveDataSize)
            notifyObservers(this);
        this.recieveDataSize = recieveDataSize;
    }

    public void clear() {
        setAssociated(false);
        setInactiveTime(0);
        setRecieveDataSize(0);
        setSentDataSize(0);
        setSignal(0);
    }

    @Override
    public String toString() {
        return client + " [inactiveTime=" + inactiveTime
                + ", isAssociated=" + isAssociated
                + ", signal=" + signal
                + ", sentDataSize=" + sentDataSize
                + ", recieveDataSize=" + recieveDataSize + "]";
    }

}
